/*
 * request.h
 *
 *  Created on: Aug 28, 2011
 *      Author: anonovermind <anonovermind@gmail.com>
 */

#ifndef REQUEST_H_
#define REQUEST_H_

#include <memory>
#include <boost/signals2.hpp>
#include "url.h"

namespace Wishmaster2
{

namespace Network
{

	typedef std::shared_ptr<std::vector<char> > VectorPtr;

	class Request
	{
	public:
		typedef boost::signals2::signal<void (int)> finished_signal;
		typedef boost::signals2::signal<void (int, int, int)> progress_signal;
		typedef boost::signals2::signal<void (int, const std::string&)> error_signal;

		virtual ~Request() {}

		virtual int id() const = 0;

		virtual void perform() = 0;
		virtual void cancel() = 0;

		virtual boost::signals2::connection connectSignalFinished(const finished_signal::slot_type& finished) = 0;
		virtual boost::signals2::connection connectSignalProgress(const progress_signal::slot_type& progress) = 0;
		virtual boost::signals2::connection connectSignalError(const error_signal::slot_type& error) = 0;

		virtual VectorPtr content() = 0;
		virtual std::string contentType() const = 0;

		virtual Url url() const = 0;

		virtual void setParameter(const std::string& paramName, const std::string& paramValue) = 0;
		virtual void addBinaryData(const std::string& paramName, const std::string& dataName, const std::vector<char>& data) = 0;

	};

	typedef std::shared_ptr<Request> RequestPtr;
}

}



#endif /* REQUEST_H_ */
